# @Time    : 2022/7/16 13:47
# @Author  : mobai
# @Email   : 3111283671@qq.com
# @File    : sjtj_page.py
# @Software: PyCharm

from selenium.webdriver.support.select import Select
from pages.shangji_page import ShangJiPage
from selenium.webdriver.common.by import By
from time import sleep


class SjtjPage(ShangJiPage):
    """商机统计页面"""
    url = "http://192.168.1.151/crm/index.php?m=business&a=analytics"
    zxbm = (By.ID, "department")
    DJSS = (By.CSS_SELECTOR, "#searchForm > ul > li:nth-child(4) > button")
    LDT = (By.ID, "show_status")
    GDXX = (By.CSS_SELECTOR, '#highcharts-24 > svg > g.highcharts-button')
    DYTB = (By.CSS_SELECTOR, "#highcharts-24 > div > div > div:nth-child(3)")

    def xzbm(self,bm):
        """选择部门"""
        XZBM = self.driver.find_element(*self.zxbm)
        select = Select(XZBM)
        select.select_by_visible_text(bm)

    def djss(self):
        """点击搜索"""
        self.driver.find_element(*self.DJSS).click()

    def xsldt(self):
        """点击销售漏斗图"""
        self.driver.find_element(*self.LDT).click()
        sleep(2)

    def gdxx(self):
        """点击更多选项"""
        self.driver.find_element(*self.GDXX).click()

    def dytb(self):
        """点击存储图标"""
        self.driver.find_element(*self.DYTB).click()
        sleep(2)

